package com.hotel.project.demo.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hotel.project.demo.domain.HotelCommentEntity;
import com.hotel.project.demo.domain.HotelEntity;
import com.hotel.project.demo.domain.ResponseBean;
import com.hotel.project.demo.service.HotelCommentService;
import com.hotel.project.demo.service.HotelDetailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : [c]
 * @version : [v1.0]
 * @description : [一句话描述该类的功能]
 * @createTime : [2022/4/11 22:41]
 * @updateUser : [c]
 * @updateTime : [2022/4/11 22:41]
 * @updateRemark : [说明本次修改内容]
 */
@RestController
@RequestMapping("/hotel")
public class HotelDetailController extends BaseController<HotelDetailService, HotelEntity>{
    /**
     * @Author lyz 罗永枝
     * @Description 根据酒店id和app定位信息获取酒店信息
     * @Param [id, longitude, latitude]
     * @return com.hotel.project.demo.domain.ResponseBean
     **/
    @GetMapping("/select-by-id")
    public ResponseBean selectById(Long id, Double longitude, Double latitude){
        ResponseBean rb = new ResponseBean();
        List<HotelEntity> hotelEntityList = service.list(Wrappers.<HotelEntity>lambdaQuery().eq(HotelEntity::getId, id).eq(HotelEntity::getLatitude, latitude).eq(HotelEntity::getLongitude, longitude));
        rb.setData(hotelEntityList);
        return rb;
    }
}
